package edu.jhu.tcj.purfuit;

import javax.swing.JOptionPane;

/**
 * 
 * @author Brad Gabrielse
 */
public class CenterSpace extends Space {

	/** Potential categories for the final question */
	private final Category[] categories;

	/**
	 * Constructor for the center space
	 * @param categories
	 */
	public CenterSpace(int ID, Category[] categories) {
		super(ID, true, false);
		this.categories = categories;
	}
	
	/**
	 * @return true if the space is the center space
	 */
	public boolean isCenterSpace() {
		return true;
	}
	
	public Question generateQuestion() {
		int categoryLength = categories.length;
		Category c = (Category)JOptionPane.showInputDialog(
                null,
                "Other players please vote and select a cateogry: ",
                "Vote on final question Category:",
                JOptionPane.PLAIN_MESSAGE,
                null,
                categories,
                null);
		return QuestionFactory.getInstance().generateQuestion(c);
	}
}
